package mapper;

import model.Department;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;
import org.springframework.stereotype.Repository;

import java.util.List;

public interface DepartmentMapper {
    @Select("select * from department")
    @Results({
            @Result(id = true,property = "id",column = "id"),
            @Result(property = "usersList",column = "id",javaType = List.class,
            many = @Many(select = "mapper.SysUsersMapper.findByDepartmentId",fetchType = FetchType.EAGER  ))
    })

    List<Department> findAll();
}
